home *** CD-ROM | disk | FTP | other *** search
/ Mac OS on the PowerPC Mic…rocessor - In Store Demo / Mac OS on the PowerPC Microprocessor.iso / MacOS / MacOS.dxr / 00057_Start and Stop.ls < prev    next >
Encoding:
Text File  |  1996-05-13  |  12.1 KB  |  363 lines

  1. global onIBM, gStartVolume, gmasterfolderpath, gDelimiter, gFileName, gGraphicPath, gSkipInit, gKiosk, gQuick, gQuitPict, gBookmark, theQTMovie, theBlitPict, theSparkle, objPreview, objIndexBtn, objalphabetbtn, objChapterBtn, objVolumeBtn, objCapturePict, objBookmark
  2.  
  3. on startMovie
  4.   set the exitLock to 1
  5.   set the keyDownScript to "StdKeyDownScript"
  6.   watchon()
  7.   repeat with n = 1 to 48
  8.     set the visible of sprite n to 0
  9.   end repeat
  10.   updateStage()
  11.   go(1)
  12.   watchon()
  13.   openingupsetting()
  14.   watchon()
  15.   initialsetting()
  16.   setMenu()
  17.   setIndexBtn()
  18.   watchon()
  19.   go(2)
  20. end
  21.  
  22. on keyDown
  23.   StdKeyDownScript()
  24. end
  25.  
  26. on StdKeyDownScript
  27.   if the commandDown = 1 then
  28.     dontPassEvent()
  29.   end if
  30. end
  31.  
  32. on playDoneMovie
  33.   if objectp(theQTMovie) then
  34.     QTPause(theQTMovie)
  35.     QTDispose(theQTMovie)
  36.   end if
  37.   repeat with n = 1 to 48
  38.     set the visible of sprite n to 0
  39.     set the puppet of sprite n to 0
  40.   end repeat
  41.   updateStage()
  42.   if gBookmark then
  43.     mSaveBookMarkPreference(objBookmark)
  44.   end if
  45.   killpreview()
  46.   killsparkle(theSparkle)
  47.   killIndexBtn()
  48.   if onIBM then
  49.     closeXLib("FILEIO")
  50.     closeXLib("BLITPICT")
  51.     closeXLib("BATQT")
  52.   end if
  53. end
  54.  
  55. on stopMovieProcess
  56.   if objectp(theQTMovie) then
  57.     QTPause(theQTMovie)
  58.     QTDispose(theQTMovie)
  59.   end if
  60.   repeat with n = 1 to 48
  61.     set the visible of sprite n to 0
  62.     set the puppet of sprite n to 0
  63.   end repeat
  64.   updateStage()
  65.   if gQuitPict then
  66.     importFileInto(cast 1, gGraphicPath & "QUIT.PCT")
  67.     set the regPoint of cast 1 to point(the width of cast 1 / 2, the height of cast 1 / 2)
  68.     go("logo")
  69.     set the visible of sprite 1 to 1
  70.     updateStage()
  71.     startTimer()
  72.     repeat while the timer < 120
  73.     end repeat
  74.   end if
  75.   if gBookmark then
  76.     mSaveBookMarkPreference(objBookmark)
  77.   end if
  78.   killpreview()
  79.   killsparkle(theSparkle)
  80.   killIndexBtn()
  81.   if onIBM then
  82.     closeXLib("Fileio")
  83.     closeXLib("Blitpict")
  84.     closeXLib("Batqt")
  85.   end if
  86.   set the soundLevel to gStartVolume
  87.   clearGlobals()
  88. end
  89.  
  90. on startOver
  91.   repeat with n = 48 down to 1
  92.     set the visible of sprite n to 0
  93.     set the puppet of sprite n to 0
  94.   end repeat
  95.   updateStage()
  96.   killpreview()
  97.   if objectp(theQTMovie) then
  98.     QTDispose(theQTMovie)
  99.   end if
  100.   killsparkle(theSparkle)
  101.   killIndexBtn()
  102.   set objPreview to EMPTY
  103.   set theBlitPict to EMPTY
  104.   set theSparkle to EMPTY
  105.   set theQTMovie to EMPTY
  106.   set objIndexBtn to EMPTY
  107.   set objalphabetbtn to EMPTY
  108.   set objChapterBtn to EMPTY
  109.   set objVolumeBtn to EMPTY
  110.   set objCapturePict to EMPTY
  111.   if onIBM then
  112.     closeXLib("Fileio")
  113.     closeXLib("Blitpict")
  114.     closeXLib("Batqt")
  115.   end if
  116.   put "." into field 32
  117.   put "." into field 33
  118.   put "." into field 34
  119.   put "." into field 37
  120.   put "." into field 35
  121.   clearGlobals()
  122.   unLoadCast()
  123. end
  124.  
  125. on openingupsetting
  126.   global gJPWinFont, glessonlist, glessonnumber, objChapterBtn, gChapterBtnLocList, objVolumeBtn, gVolumeBtnLocList, gallchapterlist, galllessonlist, gHelpChapter, gHelpParagraph, gKeywordDataList, gkeywordtext, gAlphabetExist
  127.   set the exitLock to 1
  128.   set the keyDownScript to "filterQuit"
  129.   set gStartVolume to the soundLevel
  130.   if the machineType = 256 then
  131.     set onIBM to 1
  132.     set gDelimiter to "\"
  133.     set gFileName to [:]
  134.     addProp(gFileName, #INITXT, "INI.TXT")
  135.     addProp(gFileName, #PREVIEW, "PREVIEW.BMP")
  136.     addProp(gFileName, #sparkle, "SPARKLE.BMP")
  137.     addProp(gFileName, #INDEXBTN, "INDEXBTN.BMP")
  138.     addProp(gFileName, #INTROP, "INTRO.BMP")
  139.     addProp(gFileName, #INTROM, "INTRO.MOV")
  140.     addProp(gFileName, #IFTXT, "IF.TXT")
  141.     addProp(gFileName, #Alphabet, "ALPHADN.BMP")
  142.     openXLib("Fileio")
  143.     openXLib("Blitpict")
  144.     openXLib("Batqt")
  145.     set objPreview to birth(script "blitPict parent for MPC")
  146.     set theBlitPict to birth(script "blitPict parent for MPC")
  147.     set theSparkle to birth(script "sparkle parent for MPC")
  148.     set theQTMovie to birth(script "batQT parent for MPC")
  149.     set objIndexBtn to birth(script "blitPict parent for MPC")
  150.     set objalphabetbtn to birth(script "blitPict parent for MPC")
  151.     set objCapturePict to birth(script "blitPict parent for MPC")
  152.     if not (the romanLingo) then
  153.       set tTestTextCast to the number of cast "FontTest_TextField"
  154.       set the textFont of cast tTestTextCast to "√ál√ár √áo√âS√âV√âb√âN"
  155.       if the textFont of cast tTestTextCast = "√ál√ár √áo√âS√âV√âb√âN" then
  156.         set gJPWinFont to "√ál√ár √áo√âS√âV√âb√âN"
  157.       else
  158.         set gJPWinFont to "√ØW√®√Ñ√âS√âV√âb√âN"
  159.       end if
  160.     end if
  161.   else
  162.     set onIBM to 0
  163.     set gDelimiter to ":"
  164.     set gFileName to [:]
  165.     addProp(gFileName, #INITXT, "INI.TXT")
  166.     addProp(gFileName, #PREVIEW, "PREVIEW.PCT")
  167.     addProp(gFileName, #sparkle, "SPARKLE.PCT")
  168.     addProp(gFileName, #INDEXBTN, "INDEXBTN.PCT")
  169.     addProp(gFileName, #INTROP, "INTRO.PCT")
  170.     addProp(gFileName, #INTROM, "INTRO.MOV")
  171.     addProp(gFileName, #IFTXT, "IF.TXT")
  172.     addProp(gFileName, #Alphabet, "ALPHADN.PCT")
  173.     set objPreview to birth(script "blitPict parent for Mac")
  174.     set theBlitPict to birth(script "blitPict parent for Mac")
  175.     set theSparkle to birth(script "sparkle parent for Mac")
  176.     set theQTMovie to birth(script "QTMovie parent for Mac")
  177.     set objIndexBtn to birth(script "blitPict parent for Mac")
  178.     set objalphabetbtn to birth(script "blitPict parent for Mac")
  179.     set objCapturePict to birth(script "blitPict parent for Mac")
  180.   end if
  181.   set initxtfile to fileIOread(the pathName & getProp(gFileName, #INITXT))
  182.   if item 3 of line 1 of initxtfile = EMPTY then
  183.     set external to 0
  184.   else
  185.     set external to integer(item 3 of line 1 of initxtfile)
  186.   end if
  187.   if onIBM then
  188.     if the controlDown or (external <> 0) then
  189.       set thePath to line 2 of initxtfile
  190.       set the itemDelimiter to ":"
  191.       openXLib("Labeldrv.dll")
  192.       set objLabelDrv to LabelDrv(mnew)
  193.       objLabelDrv(mSetRange, "A", "Z")
  194.       set driveName to objLabelDrv(mGetDrive, item 1 of thePath)
  195.       objLabelDrv(mdispose)
  196.       closeXLib("Labeldrv.dll")
  197.       set gmasterfolderpath to char 1 of driveName & ":\"
  198.       repeat with n = 2 to the number of items in thePath - 1
  199.         put item n of thePath & "\" after gmasterfolderpath
  200.       end repeat
  201.       set the itemDelimiter to ","
  202.     else
  203.       set thePath to line 2 of initxtfile
  204.       set the itemDelimiter to ":"
  205.       set thefoldername to item the number of items in thePath - 1 of thePath
  206.       set gmasterfolderpath to the pathName & thefoldername & "\"
  207.       set the itemDelimiter to ","
  208.     end if
  209.   else
  210.     if the controlDown or (external <> 0) then
  211.       set gmasterfolderpath to line 2 of initxtfile
  212.     else
  213.       set thePath to line 2 of initxtfile
  214.       set the itemDelimiter to ":"
  215.       set thefoldername to item the number of items in thePath - 1 of thePath
  216.       set gmasterfolderpath to the pathName & thefoldername & ":"
  217.       set the itemDelimiter to ","
  218.     end if
  219.   end if
  220.   if onIBM then
  221.     if item 5 of line 1 of initxtfile = EMPTY then
  222.       set gGraphicPath to gmasterfolderpath & "GRAPHIC" & gDelimiter
  223.     else
  224.       set gGraphicPath to gmasterfolderpath & item 5 of line 1 of initxtfile & gDelimiter
  225.     end if
  226.   else
  227.     if item 4 of line 1 of initxtfile = EMPTY then
  228.       set gGraphicPath to gmasterfolderpath & "GRAPHIC" & gDelimiter
  229.     else
  230.       set gGraphicPath to gmasterfolderpath & item 4 of line 1 of initxtfile & gDelimiter
  231.     end if
  232.   end if
  233.   set tFlag to item 6 of line 1 of initxtfile
  234.   if (tFlag = EMPTY) or (tFlag = "0") then
  235.     set gSkipInit to 0
  236.     set gKiosk to 0
  237.   else
  238.     if tFlag = "1" then
  239.       set gSkipInit to 1
  240.       set gKiosk to 0
  241.     else
  242.       if tFlag = "2" then
  243.         set gSkipInit to 0
  244.         set gKiosk to 1
  245.       end if
  246.     end if
  247.   end if
  248.   set tFlag to item 7 of line 1 of initxtfile
  249.   if (tFlag = EMPTY) or (tFlag = "0") then
  250.     set gQuick to 0
  251.   else
  252.     if tFlag = "1" then
  253.       set gQuick to 1
  254.     end if
  255.   end if
  256.   fileIOread(gmasterfolderpath & "PREP1.TXT")
  257.   set glessonlist to the result
  258.   set glessonnumber to the number of lines in glessonlist
  259.   set the text of cast 32 to glessonlist
  260.   set objGraphic to birth(script "parent <change graphic>")
  261.   importGraphic(objGraphic, external)
  262.   set objGraphic to EMPTY
  263.   set objChapterBtn to birth(script "Parent<Slider2>", gChapterBtnLocList, 13)
  264.   set objVolumeBtn to birth(script "Parent<Slider2>", gVolumeBtnLocList, 14)
  265.   slideListSet(objVolumeBtn, 8)
  266.   fileIOread(gmasterfolderpath & "PREP2.TXT")
  267.   set galllessonlist to getAt(value(the result), 1)
  268.   set gallchapterlist to getAt(value(the result), 2)
  269.   if gHelpChapter = 0 then
  270.     set gHelpChapter to glessonnumber
  271.   else
  272.     if gHelpChapter > glessonnumber then
  273.       set gHelpChapter to glessonnumber
  274.     end if
  275.   end if
  276.   set theLastParagraph to getAt(getAt(galllessonlist, gHelpChapter), 2)
  277.   if gHelpParagraph = 0 then
  278.     set gHelpParagraph to theLastParagraph
  279.   else
  280.     if gHelpParagraph > theLastParagraph then
  281.       set gHelpParagraph to theLastParagraph
  282.     end if
  283.   end if
  284.   fileIOread(gmasterfolderpath & "PREP3.TXT")
  285.   set gkeywordtext to the result
  286.   fileIOread(gmasterfolderpath & "PREP4.TXT")
  287.   set gKeywordDataList to getAt(value(the result), 1)
  288.   set gAlphabetExist to getAt(value(the result), 2)
  289. end
  290.  
  291. on initialsetting
  292.   global gPauseMode, gcurrlessonnumber, gcurrchapternumber, gchapternumber, gstartupflag, theSparkle, gPICTQTList
  293.   set gPauseMode to 1
  294.   setpreview()
  295.   set gcurrlessonnumber to 1
  296.   set gcurrchapternumber to 1
  297.   set gchapternumber to getchapternumber(gcurrlessonnumber)
  298.   set gstartupflag to 1
  299.   loadsparkle(theSparkle)
  300.   set gPICTQTList to []
  301.   set pictscreenlist to []
  302.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  303.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  304.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  305.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  306.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1])
  307.   add(pictscreenlist, [0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 1, 1, 1, 0, 1])
  308.   add(pictscreenlist, [0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 1, 1, 1, 0, 1])
  309.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 2, 1, 1, 1, 1, 1, 0, 1])
  310.   add(pictscreenlist, [0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 1, 1, 1, 0, 1])
  311.   add(pictscreenlist, [0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 1, 1, 1, 0, 1])
  312.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  313.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  314.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  315.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  316.   add(pictscreenlist, [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 2, 2, 2, 0, 2])
  317.   set prevclrlist to []
  318.   add(prevclrlist, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  319.   add(prevclrlist, [3, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  320.   add(prevclrlist, [3, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2])
  321.   add(prevclrlist, [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0])
  322.   add(prevclrlist, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  323.   add(prevclrlist, [3, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  324.   add(prevclrlist, [3, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  325.   add(prevclrlist, [3, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  326.   add(prevclrlist, [3, 1, 3, 2, 3, 1, 1, 1, 0, 1, 2, 0, 2, 2, 2])
  327.   add(prevclrlist, [2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2])
  328.   add(prevclrlist, [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0])
  329.   add(prevclrlist, [3, 1, 3, 2, 3, 1, 1, 1, 0, 1, 2, 0, 2, 2, 2])
  330.   add(prevclrlist, [3, 1, 1, 2, 3, 1, 1, 1, 0, 1, 2, 0, 0, 2, 2])
  331.   add(prevclrlist, [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0])
  332.   add(prevclrlist, [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0])
  333.   set smallscreenlist to [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0]
  334.   set gPICTQTList to [pictscreenlist, prevclrlist, smallscreenlist]
  335. end
  336.  
  337. on fileIOwrite thePath, theText
  338.   if objectp(objfileio) then
  339.     objfileio(mdispose)
  340.   end if
  341.   set objfileio to FileIO(mnew, "write", thePath)
  342.   if objectp(objfileio) then
  343.     objfileio(mWriteString, theText)
  344.     objfileio(mdispose)
  345.   else
  346.     alert(thePath && "write error")
  347.   end if
  348. end
  349.  
  350. on fileIOread thePath
  351.   if objectp(objfileio) then
  352.     objfileio(mdispose)
  353.   end if
  354.   set objfileio to FileIO(mnew, "read", thePath)
  355.   if objectp(objfileio) then
  356.     set theText to objfileio(mReadFile)
  357.     objfileio(mdispose)
  358.   else
  359.     alert(thePath && "read error")
  360.   end if
  361.   return theText
  362. end
  363.